<!--
 * @Author: 花香蝶自来 1026583651@qq.com
 * @Date: 2024-04-16 18:35:31
 * @LastEditors: 花香蝶自来 1026583651@qq.com
 * @LastEditTime: 2024-05-28 19:56:15
 * @FilePath: /crm/components/formz/components/formselect.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<view class="">
		<u-form-item :label="item.label" borderBottom ref="item1" :prop="item.value">
			<!-- <view  >{{ inputValue }}</view> -->
			<view @click="show = true" style="flex: 1;padding: 0;" :class="[
	      value ? 'uni-input-input' : 'select-wrap',
	    ]">{{ inputValue }}</view>
		</u-form-item>
		<u-action-sheet :actions="list" :show="show" @select="select" @close="show = false"></u-action-sheet>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// inputValue: "",
				show: false,
			};
		},
		computed: {
			list() {
				return this.item.option.map((e) => {
					return {
						...e,
						name: e.label,
					};
				});
			},
			inputValue() {
				return (
					this.item.option.find((e) => e.value == this.value)?.label || "请选择"
				);
			},
		},
		props: {
			item: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			data: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			value: {
				typeof: [String, Number, Boolean, Array, Object],
				default: () => {
					return "";
				},
			},
		},

		methods: {
			blur() {
				this.$emit("input", this.inputValue);
			},
			select(e) {
				// console.log(e);
				this.$emit("input", String(e.value));
				this.show = false;
				console.log(e, "111");
			},
		},
	};
</script>

<style scoped lang="scss">
	.uni-input-input {
		font-size: 14px !important;
		color: #171A1D !important;
		line-height: 99rpx !important;
		height: 99rpx !important;
		padding-left: 10px;
	}

	.uni-forms-item__label {
		margin-left: 0;
		font-size: 14px !important;
		color: #171A1D !important;
		line-height: 99rpx !important;
		height: 99rpx !important;
	}
</style>